package com.vegetable.modules.entity.stock;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.vegetable.common.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * <p>
 * 销售出库变更记录表
 * 用于记录commodities和costs的变化
 * </p>
 *
 * @author system
 * @since 2025-10-23
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sales_out_change_record")
@ApiModel(value="SalesOutChangeRecord对象", description="销售出库变更记录表")
public class SalesOutChangeRecord extends BaseEntity {

    @ApiModelProperty(value = "销售出库单ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long salesOutId;

    @ApiModelProperty(value = "单据编号")
    private String docNo;

    @ApiModelProperty(value = "订单时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private Date orderTime;

    @ApiModelProperty(value = "操作类型：SAVE-保存, SUBMIT-提交, UPDATE-修改, DELETE-删除")
    private String operationType;

    @ApiModelProperty(value = "变更类型：COMMODITY-商品明细, COST-其他费用, COMBINED-综合变更")
    private String changeType;

    @ApiModelProperty(value = "变更前数据(JSON格式)")
    @TableField(value = "before_data")
    private String beforeData;

    @ApiModelProperty(value = "变更后数据(JSON格式)")
    @TableField(value = "after_data")
    private String afterData;

    @ApiModelProperty(value = "变更摘要描述")
    private String changeSummary;

    @ApiModelProperty(value = "操作人ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long operatorId;

    @ApiModelProperty(value = "操作人姓名")
    private String operatorName;

    @ApiModelProperty(value = "操作时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date operateTime;

    @ApiModelProperty(value = "生产者ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long producerId;

    @ApiModelProperty(value = "客户ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long customerId;

    @ApiModelProperty(value = "客户名称")
    private String customerName;

    @ApiModelProperty(value = "备注")
    private String remark;
}
